package ms.utils;

import java.util.ArrayList;

public class NamedList<E extends INamedItem> extends ArrayList<E>  implements INamedList<E> {

	private static final long serialVersionUID = 1L;

	@Override
	public int indexOf(String name) {
		for (int i = 0; i < size(); i++)
			if (name.equalsIgnoreCase(get(i).getName()))
				return i;
		return -1;
	}

	public E get(String name) {
		int idx = indexOf(name);
		return idx != -1 ? super.get(idx) : null;
	}

}
